﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.UI.WebControls;
using BootstrapMvc.Models;

namespace BootstrapMvc.Controllers
{
    public class HomeworkController : Controller
    {
        /// <summary>
        /// 主页
        /// </summary>
        /// <returns></returns>
        public ActionResult IndexTest(SearchModel searchmodel)
        {
            searchmodel = searchmodel ?? new SearchModel();
            List<IndexModel> ModelList=new List<IndexModel>();
            for (int i = 1; i < 9; i++)
            {
                IndexModel model=new IndexModel();
                model.Name = "jzb." + i;
                model.Num = i.ToString();
                model.Age = 15 + i;
                model.Tel = "1381417784" + i;
                model.Address = "苏州" + i;
                if (!string.IsNullOrEmpty(searchmodel.Name) && !string.IsNullOrEmpty(searchmodel.Num))
                {
                    if (model.Name == searchmodel.Name && model.Num == searchmodel.Num)
                    {
                        ModelList.Add(model);
                    }
                }
                else if (!string.IsNullOrEmpty(searchmodel.Name) )
                {
                    if (model.Name == searchmodel.Name)
                    {
                        ModelList.Add(model);
                    }
                }
                else if (!string.IsNullOrEmpty(searchmodel.Num))
                {
                    if (model.Num == searchmodel.Num)
                    {
                        ModelList.Add(model);
                    }
                }
                else
                {
                    ModelList.Add(model);
                } 
            }
            ViewBag.ResultList = ModelList;
            return View();
        }

        /// <summary>
        /// 新增弹层
        /// </summary>
        /// <returns></returns>
        public ActionResult Show()
        {
            return View();
        }
    }
}